package com.funsport.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * 用户状态枚举
 *
 * @author Fun-Sport Team
 */
@Getter
public enum UserStatus {

    /**
     * 激活
     */
    ACTIVE("active", "激活"),

    /**
     * 未激活
     */
    INACTIVE("inactive", "未激活"),

    /**
     * 已禁用
     */
    BANNED("banned", "已禁用");

    @EnumValue
    @JsonValue
    private final String value;

    private final String description;

    UserStatus(String value, String description) {
        this.value = value;
        this.description = description;
    }

    public static UserStatus fromValue(String value) {
        for (UserStatus status : UserStatus.values()) {
            if (status.getValue().equals(value)) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的用户状态: " + value);
    }
}

